package com.light.mytext.mvvp

import androidx.databinding.ObservableInt
import androidx.lifecycle.MutableLiveData

class MainViewModel {
    var name = "张三"
    var age = ObservableInt(20)//因为涉及双向绑定，这里必须是可观察的数据类型
//    var age = 20
    var sex = "女"
    var isMan = true

    fun Log() {
        android.util.Log.d("MyMvvp", "点击了一下")
    }

    fun converSex(): String {
        var result = "性别："
        var sex = if (isMan) "男" else "女"
        return result + sex
    }

    fun oneYearLater(){
        var lastage=age.get()
        age.set(lastage+1)
    }
    fun setman():Boolean{
        return  !isMan
    }

}